<template>
  <SubTableItemCard
      @edit="data => emits('edit', data)"
      :context="context" :config="config"
      :subForm="subForm"
      v-for="(item, index) in dataSource"
      :formModel="item"
      @remove="() => emits('remove', index)"
      @copy="formModel => emits('copy', formModel)"
      :row-index="index"/>
</template>
<script setup>
import {createProps} from '@/utils';
import SubTableItemCard from '@comp/FormEngine/field/SubTable/SubTableItemCard.vue';

defineOptions({name: 'SubTableList'})
const emits = defineEmits(['edit', 'remove', 'copy']);

const props = defineProps({
  dataSource: createProps(Array, () => []),
  subForm: createProps(Object, () => undefined),
  config: createProps(Object, () => undefined),
  context: createProps(Object, () => undefined),
})
</script>
<style scoped lang="less">

</style>